package com.shanjupay.merchant.service;

import com.shanjupay.common.domain.BusinessException;
import com.shanjupay.merchant.api.MerchantService;
import com.shanjupay.merchant.api.dto.MerchantDTO;
import com.shanjupay.merchant.convert.MerchantConvert;
import com.shanjupay.merchant.entity.Merchant;
import com.shanjupay.merchant.mapper.MerchantMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MerchantServiceImplVer implements MerchantService {

    @Autowired
    MerchantMapper mapper;



    @Override
    public MerchantDTO queryMerchantById(Long id) {
        return null;
    }

    @Override
    public MerchantDTO createMerchant(MerchantDTO merchantDTO) throws BusinessException {

        Merchant merchant = MerchantConvert.INSTANCE.dto2entity(merchantDTO);
        //设置一下商户的状态为0
        merchant.setAuditStatus("0");
        mapper.insert(merchant);

        return merchantDTO;

    }
}
